<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->

    <title>图片管理工具</title>

    <jsp:include page="/common/header.jsp" />


    <!-- justifiedGallery -->
    <script src="<%=request.getContextPath()%>/common/justifiedGallery/jquery.justifiedGallery.min.js"></script>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/common/justifiedGallery/justifiedGallery.min.css" />

    <!-- swipebox -->
    <script src="<%=request.getContextPath()%>/common/swipebox-master/src/js/jquery.swipebox.min.js"></script>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/common/swipebox-master/src/css/swipebox.min.css" />



  </head>
  <body style="background-color: white; padding: 10px;">

    <jsp:include page="/common/top.jsp?navType=li-img-hl" />


    <div class="container-fluid">
      <button type="button" class="btn btn-danger btn-xs" method="132">
        资料库：${repository }
      </button>

      <c:forEach items="${sonRepositoryList }" var="son">
        <button type="button" class="btn btn-success btn-xs" sonRepository="${son.path }" method="132" isCurrent="${son.isCurrent }">
          ${son.name }
        </button>
      </c:forEach>

      <hr style="margin: 10px 0px 10px 0px;" />


      <div id="basicExample">

        <c:forEach items="${imgList }" var="img">
          <a href="<c:url value='/imageShow?method=130&imgId=${img.id}'/>" class="swipebox"> <img
              src="<c:url value='/imageShow?method=130&imgId=${img.id}'/>" title1="${img.title }" w="${img.width }" h="${img.height }" /> </a>
        </c:forEach>
      </div>
    </div>




  </body>
</html>


<script type="text/javascript">
	$(function() {
		$(".swipebox").swipebox();
		$("#basicExample").justifiedGallery({
			//rowHeight : 70,
			lastRow : 'nojustify',
			margins : 1,
			captions : true
		});
	}).on('jg.complete', function(e) {
		//$("img").show();
	});

	$("button[method=132]").click(
			function() {
				var sonRepository = $(this).attr("sonRepository");
				sonRepository = sonRepository ? sonRepository : "";
				if (sonRepository) {
					sonRepository = encodeURI(sonRepository);
				}
				var url = "<c:url value='imageShow' />"
						+ "?method=132&sonRepository=" + sonRepository;
				window.location.href = url;
			});
	$("button[method=132]").each(function() {
		var isCurrent = $(this).attr("isCurrent");
		if (isCurrent == "true") {
			$(this).addClass("btn-danger");
			$(this).unbind("click");
		} else {
			$(this).addClass("btn-success");
		}
	});
</script>